package com.clkj.sunhelp.mvp.publicityshow.publicityofapplyobjdetail;

import android.os.Bundle;
import android.widget.TextView;

import com.clkj.sunhelp.R;
import com.clkj.sunhelp.adapter.list.ListAdapterForFirstAndSecPublicity;
import com.clkj.sunhelp.app.CustomApplication;
import com.clkj.sunhelp.bean.PublicityItem;
import com.clkj.sunhelp.bean.PublicityOfApplyObjDetail;
import com.clkj.sunhelp.bean.PublicityOfApplyObjItem;
import com.clkj.sunhelp.common.IntentKey;
import com.clkj.sunhelp.mvp.base.BaseActivity;
import com.clkj.sunhelp.util.ToastUtil;
import com.clkj.sunhelp.util.schedulers.SchedulerProvider;
import com.clkj.sunhelp.widget.ListViewForScrollView;

import java.util.ArrayList;
import java.util.List;

/**申请对象公示详情
 * Created by Administrator on 2017/3/27.
 */

public class ActivityPublicityOfApplyObjDetail extends BaseActivity implements PublicityOfApplyObjDetailContract.View{
    private TextView tvGongshiTitle;
    private TextView tvGongshiContent;
    private TextView tvGovinfoAndTime;
    private ListViewForScrollView lvPublicityResult;

    List<PublicityItem> mPublicityList = new ArrayList<>();
    ListAdapterForFirstAndSecPublicity mAdapter;




    //String mPublicityId;


    PublicityOfApplyObjDetailContract.Presenter mPresenter;


    PublicityOfApplyObjItem mPublicityItem;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_first_publicity_apply_obj_detail_view_new);
        initTitleWithRightTvOrIv(null,null,"公示详情",true,null,null);
        initData();
        assignView();
        initView();
        mPresenter = new PublicityOfApplyObjDetailPresenter(this, SchedulerProvider.getInstance(), CustomApplication.getInstance().getHttpService());
        //getPublicityDetail();
    }

    @Override
    public void initData() {
        mPublicityItem = (PublicityOfApplyObjItem) getIntent().getSerializableExtra(IntentKey.INTENT_KEY_PUBLICITY_OF_APPLY_OBJ_ITEM);

        PublicityItem publicityItem = new PublicityItem();
        publicityItem.setHuZhuName("张三");
        publicityItem.setHealthyInfo("一般");
        publicityItem.setFamilyPersonNum("5");
        publicityItem.setMonthIncomeTotal("1000");
        publicityItem.setMonthBuZhuMoneyTotal("500");
        publicityItem.setMingZhuExamResult("同意");
        publicityItem.setExamResult("同意");

        mPublicityList.add(publicityItem);
        mPublicityList.add(publicityItem);
        mPublicityList.add(publicityItem);
        mPublicityList.add(publicityItem);
        mPublicityList.add(publicityItem);
        mPublicityList.add(publicityItem);
        mPublicityList.add(publicityItem);
        mPublicityList.add(publicityItem);
        mPublicityList.add(publicityItem);
        mPublicityList.add(publicityItem);


    }

    @Override
    public void assignView() {
        tvGongshiTitle = (TextView) findViewById(R.id.tv_gongshi_title);
        tvGongshiContent = (TextView) findViewById(R.id.tv_gongshi_content);
        tvGovinfoAndTime = (TextView) findViewById(R.id.tv_govinfo_and_time);
        lvPublicityResult = (ListViewForScrollView) findViewById(R.id.lv_publicity_result);
    }

    @Override
    public void initView() {
        //CommonUtil.initWebView(wv);
        mAdapter = new ListAdapterForFirstAndSecPublicity(mPublicityList,this);
        lvPublicityResult.setAdapter(mAdapter);

    }

    @Override
    public void getPublicityDetail() {
        //mPresenter.getPublicityDetail(mPublicityItem.getId(),mPublicityItem.getCunCode(),mPublicityItem.getTypestr());
    }

    @Override
    public void onGetPublicityDetailSuccess(PublicityOfApplyObjDetail detail) {
       // wv.loadDataWithBaseURL(Config.URL_BASE_IN_USE,detail.getContent(),"text/html","utf-8",null);
    }

    @Override
    public void onGetPublicityDetailError(String tip) {
        ToastUtil.showShort(this,tip);
    }

    @Override
    public void setPresenter(PublicityOfApplyObjDetailContract.Presenter presenter) {

    }

    @Override
    public void showLoading() {
        showProgressDialog(false,null);
    }

    @Override
    public void dismissLoading() {
        dismissProgressDialog();
    }
}
